﻿#region Copyright Info

// 
// Majesty of Omega - The next evolution of macro management space strategy
// 
// Copyright 2007-2009 André Claaßen
// 
// This file is protected by the terms and conditions of the
// Microsoft Community License (Ms-CL 1.1), a copy of which should
// have been distributed along with this software. If not,
// you may find the license information at the following URL:
// 
// http://www.microsoft.com/resources/sharedsource/licensingbasics/communitylicense.mspx

#endregion

#region

using System.Collections.Generic;
using System.Linq;
using DesignByContract;
using Majesty_of_Omega.Model.Game;
using Majesty_of_Omega.Logic.Generator;
using Majesty_of_Omega.Model.Report;

#endregion

namespace Majesty_of_Omega.GUI.Controller
{
    /// <summary>
    /// Controller of the Situation Report
    /// </summary>
    public class SitReportController : InGameController
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="SitReportController"/> class.
        /// </summary>
        /// <remarks>
        /// Default constructor for blend with a simulated Situation Report
        /// </remarks>
        public SitReportController()
        {
            TestDataGenerator generator = new TestDataGenerator();
            Game.HumanPlayer.SitReport = generator.GetTestSitReport();
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SitReportController"/> class with a given game
        /// </summary>
        /// <param name="game">The game.</param>
        /// <remarks>
        /// This is the real gameplay constructor
        /// </remarks>
        public SitReportController(SaveGame game)
            : base(game)
        {

        }

        /// <summary>
        /// Gets the turns of the situation report in reverse order
        /// </summary>
        /// <value>The turns.</value>
        public IEnumerable<SitReportTurn> Turns
        {
            get
            {
                Require.IsNotNull(saveGame);
                return saveGame.HumanPlayer.SitReport.SitReportTurns.Values.Reverse();
            }
        }
    }
}